package com.hyper_yang.javase.supplement;

import org.junit.jupiter.api.Test;

import java.util.Properties;

public class SystemTest {

    @Test
    public void test01(){
        // todo: 获取当前执行这行代码距离 1970 1 1 0点时的毫秒值
        Long l = System.currentTimeMillis();
        System.out.println(l);
        // todo: 代码正常退出
//        System.exit(0);
        // todo: 展示配置信息
        Properties properties = System.getProperties();
        properties.list(System.out);
        // todo: 触发垃圾回收机制
        System.gc();
    }

    @Test
    public void runtimetest(){
        Runtime runtime = Runtime.getRuntime();

        long total = runtime.totalMemory();
        System.out.println(total);
        long free = runtime.freeMemory();
        System.out.println(free);
    }
}
